import java.util.Arrays;
import java.util.Collections;

public class SortArrayInt1 {
	
	public static void main(String[] args) {

	    int iArr[] = {2, 1, 9, 6, 4, 8, 55, 77, 41, 0, 4};

	    System.out.println("Array before sorting");
	    for (int number : iArr) {
	      System.out.print(number+" ");
	    }
	    
	    sortIntArray(iArr);

	    System.out.println("\nArray After sorting");
	    for (int number : iArr) {
	      System.out.print( number+ " ");
	    }
	    
	}
	
	public static void sortIntArray(int[] iArr){
		for (int i=0; i<iArr.length; i++)
			for (int j=i+1; j<iArr.length; j++)
				if (iArr[i]>iArr[j])
					swap(iArr, i, j);
				
	}
	
	public static void swap(int[] iArr, int i, int j){
		int tmp=0;
		tmp = iArr[i];
		iArr[i] = iArr[j];
		iArr[j] = tmp;
		
	}
}

/* Result
Array before sorting
2 1 9 6 4 8 55 77 41 0 4 
Array After sorting
0 1 2 4 4 6 8 9 41 55 77 
*/